load("@fbsource//tools/build_defs:rust_binary.bzl", "rust_binary")
load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("scm_server_infra")

rust_library(
    name = "backsyncer",
    srcs = [
        "src/lib.rs",
        "src/tests.rs",
    ],
    test_deps = [
        "fbcode//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
        "fbsource//third-party/rust:ascii",
        "fbsource//third-party/rust:assert_matches",
        "fbsource//third-party/rust:maplit",
        "fbsource//third-party/rust:pretty_assertions",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/fbinit:fbinit-tokio",
        "//common/rust/shed/futures_ext:futures_ext",
        "//eden/mononoke/blobrepo:blobrepo_hg",
        "//eden/mononoke/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/changesets/changesets_creation:changesets_creation",
        "//eden/mononoke/commit_rewriting/live_commit_sync_config:live_commit_sync_config",
        "//eden/mononoke/commit_rewriting/movers:movers",
        "//eden/mononoke/commit_rewriting/synced_commit_mapping:synced_commit_mapping",
        "//eden/mononoke/common/rendezvous:rendezvous",
        "//eden/mononoke/common/sql_construct:sql_construct",
        "//eden/mononoke/features/commit_transformation:commit_transformation",
        "//eden/mononoke/filestore:filestore",
        "//eden/mononoke/manifest:manifest",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/repo_factory:test_repo_factory",
        "//eden/mononoke/tests/fixtures:fixtures",
        "//eden/mononoke/tests/utils:tests_utils",
    ],
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:thiserror",
        "fbsource//third-party/rust:tokio",
        "fbsource//third-party/rust:tracing",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/facet:facet",
        "//common/rust/shed/futures_stats:futures_stats",
        "//common/rust/shed/justknobs_stub:justknobs",
        "//eden/mononoke/blobstore:blobstore",
        "//eden/mononoke/bonsai_git_mapping:bonsai_git_mapping",
        "//eden/mononoke/bonsai_globalrev_mapping:bonsai_globalrev_mapping",
        "//eden/mononoke/bonsai_hg_mapping:bonsai_hg_mapping",
        "//eden/mononoke/bookmarks:bookmarks",
        "//eden/mononoke/common/rust/sql_ext:sql_ext",
        "//eden/mononoke/common/scuba_ext:scuba_ext",
        "//eden/mononoke/features/cross_repo_sync:cross_repo_sync",
        "//eden/mononoke/features/repo_update_logger:repo_update_logger",
        "//eden/mononoke/filenodes:filenodes",
        "//eden/mononoke/filestore:filestore",
        "//eden/mononoke/git_source_of_truth:git_source_of_truth",
        "//eden/mononoke/metaconfig:metaconfig_types",
        "//eden/mononoke/mononoke_macros:mononoke_macros",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/mutable_counters:mutable_counters",
        "//eden/mononoke/phases:phases",
        "//eden/mononoke/pushrebase_mutation_mapping:pushrebase_mutation_mapping",
        "//eden/mononoke/repo_attributes/commit_graph/commit_graph:commit_graph",
        "//eden/mononoke/repo_attributes/repo_blobstore:repo_blobstore",
        "//eden/mononoke/repo_attributes/repo_bookmark_attrs:repo_bookmark_attrs",
        "//eden/mononoke/repo_attributes/repo_cross_repo:repo_cross_repo",
        "//eden/mononoke/repo_attributes/repo_derived_data:repo_derived_data",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/repo_attributes/sql_query_config:sql_query_config",
        "//eden/mononoke/server/context:context",
        "//eden/mononoke/wireproto_handler:wireproto_handler",
    ],
)

rust_binary(
    name = "backsyncer_cmd",
    srcs = glob(["backsyncer_cmd/**/*.rs"]),
    autocargo = {"cargo_toml_dir": "backsyncer_cmd"},
    crate_root = "backsyncer_cmd/main.rs",
    deps = [
        "fbsource//third-party/rust:anyhow",
        "fbsource//third-party/rust:async-trait",
        "fbsource//third-party/rust:clap",
        "fbsource//third-party/rust:futures",
        "fbsource//third-party/rust:tokio",
        "fbsource//third-party/rust:tracing",
        ":backsyncer",
        "//common/rust/shed/cloned:cloned",
        "//common/rust/shed/fbinit:fbinit",
        "//common/rust/shed/stats:stats",
        "//eden/mononoke/blobrepo:blobrepo_hg",
        "//eden/mononoke/bookmarks:bookmarks",
        "//eden/mononoke/cmdlib:cmdlib_cross_repo",
        "//eden/mononoke/cmdlib:cmdlib_logging",
        "//eden/mononoke/cmdlib/mononoke_app:mononoke_app",
        "//eden/mononoke/cmdlib/sharding:executor_lib",
        "//eden/mononoke/cmdlib/sharding_ext:sharding_ext",
        "//eden/mononoke/commit_rewriting/live_commit_sync_config:live_commit_sync_config",
        "//eden/mononoke/common/metadata:metadata",
        "//eden/mononoke/derived_data/mercurial_derivation:mercurial_derivation",
        "//eden/mononoke/features/cross_repo_sync:cross_repo_sync",
        "//eden/mononoke/mercurial:mercurial_types",
        "//eden/mononoke/mononoke_types:mononoke_types",
        "//eden/mononoke/repo_attributes/repo_identity:repo_identity",
        "//eden/mononoke/server/context:context",
        "//eden/mononoke/wireproto_handler:wireproto_handler",
        "//eden/scm/lib/clientinfo:clientinfo",
    ],
)
